#ifndef FAST_STM_H
#define FAST_STM_H

#include <list>

#include "common.h"
#include "transaction.h"

#define try_atomic(T) for (transaction_t* T=initialize_transaction(); !T->committed() && T->restart(); T->end()) try
//#define try_atomic(T) for (boost::stm::transaction T; !T.committed() && T.restart(); T.no_throw_end()) try
//#define atomic(T)     for (boost::stm::transaction T; !T.committed() && T.check_throw_before_restart() && T.restart_if_not_inflight(); T.no_throw_end()) try

#define catch_before_retry(E) catch (aborted_tx &E)
#define before_retry catch (aborted_tx &)
#define end_atom catch (aborted_tx &) {}

extern void initialize();
extern void initialize_thread();
extern void finalize_thread();
extern void finalize();
extern transaction_t* initialize_transaction();
extern transaction_queue_t* g_transaction_queue;

#endif // FAST_STM_H
